package object;

/**
 * 面向对象编程（基础部分）练习
 */
public class ObjectExercise03 {

    public static void main(String[] args) {
        /*
            设计一个MyDog类，有名字、颜色和年龄属性，定义输出方法show()显示其信息。并创建对象，进行测试
         */
        MyDog dog = new MyDog("旺财", "黄色", 3);
        dog.show();
    }
}

class MyDog {

    String name;

    String color;

    int age;

    public MyDog(String name, String color, int age) {
        this.name = name;
        this.color = color;
        this.age = age;
    }

    public void show() {
        System.out.println("名称：" + name + ",颜色：" + color + ",年龄：" + age + "岁");
    }

}
